import openpyxl


workbook = openpyxl.Workbook()
ws = workbook.active
ws.title="测试excel"
ws['A1'] = "国家"
ws['B1'] = "首都"
data_excel= []
data = {'中国':'北京','韩国':'首尔'}
for each in data:
    data_excel.append([each,data[each]])

for each in data_excel:
    ws.append(each)

workbook.save("test.xlsx")




